﻿namespace Smart.Utils.System2
{
    using System;
    using System.Windows.Forms;

    public class VnMessageBox
    {
        public static DialogResult Confirm(string text)
        {
            return Show(text, Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
        }

        public static DialogResult Confirm(string text, string caption)
        {
            return Show(text, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
        }

        public static DialogResult Error(string text)
        {
            return Show(text, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
        }

        public static DialogResult Error(string text, string caption)
        {
            return Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.Hand);
        }

        public static DialogResult Error(string text, string caption, MessageBoxButtons buttons)
        {
            return Show(text, caption, buttons, MessageBoxIcon.Hand);
        }

        public static DialogResult Info(string text)
        {
            return Show(text, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
        }

        public static DialogResult Info(string text, string caption)
        {
            return Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
        }

        public static DialogResult Info(string text, string caption, MessageBoxButtons buttons)
        {
            return Show(text, caption, buttons, MessageBoxIcon.Asterisk);
        }

        public static DialogResult Question(string text)
        {
            return Show(text, Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
        }

        public static DialogResult Question(string text, string caption)
        {
            return Show(text, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
        }

        public static DialogResult Question(string text, string caption, MessageBoxButtons buttons)
        {
            return Show(text, caption, buttons, MessageBoxIcon.Question);
        }

        public static DialogResult Show(string text)
        {
            return Show(text, Application.ProductName);
        }

        public static DialogResult Show(string text, string caption)
        {
            return Show(text, caption, MessageBoxButtons.OK);
        }

        public static DialogResult Show(IWin32Window owner, string text)
        {
            return Show(null, text, string.Empty);
        }

        public static DialogResult Show(string text, string caption, MessageBoxButtons buttons)
        {
            return Show(text, caption, buttons, MessageBoxIcon.None);
        }

        public static DialogResult Show(IWin32Window owner, string text, string caption)
        {
            return Show(owner, text, caption, MessageBoxButtons.OK);
        }

        public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            return Show(text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
        }

        public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons)
        {
            return Show(owner, text, caption, buttons, MessageBoxIcon.None);
        }

        public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
        {
            return Show(text, caption, buttons, icon, defaultButton, 0);
        }

        public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            return Show(owner, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
        }

        public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
        {
            return Show(null, text, caption, buttons, icon, defaultButton, options);
        }

        public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
        {
            return Show(owner, text, caption, buttons, icon, defaultButton, 0);
        }

        public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
        {
            CSysMsgBoxHook hook = new CSysMsgBoxHook();
            hook.HookDialog();
            DialogResult none = DialogResult.None;
            none = MessageBox.Show(owner, text, caption, buttons, icon, defaultButton, options);
            hook.UnHookDialog();
            hook = null;
            return none;
        }

        public static DialogResult Warning(string text)
        {
            return Show(text, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }

        public static DialogResult Warning(string text, string caption)
        {
            return Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }

        public static DialogResult Warning(string text, string caption, MessageBoxButtons buttons)
        {
            return Show(text, caption, buttons, MessageBoxIcon.Exclamation);
        }
    }
}

